import { RouteRecordRaw } from "vue-router";
import HomeView from "@/views/HomeView.vue";
import UserLayout from "@/layouts/UserLayout.vue";
import ACCESS_CONSTANT from "@/access/accessConstant";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "主页",
    component: HomeView,
  },
  {
    path: "/admin",
    name: "管理页面",
    component: HomeView,
    meta: {
      access: ACCESS_CONSTANT.ADMIN,
    },
  },
  {
    path: "/user",
    component: UserLayout,
    meta: {
      hideInMenu: true,
    },
    children: [
      {
        path: "/user/login",
        name: "登录",
        component: () => import("../views/UserLoginView.vue"),
      },
      {
        path: "/user/register",
        name: "注册",
        component: () => import("../views/UserRegisterView.vue"),
      },
    ],
  },
  {
    path: "/403",
    name: "无权限",
    meta: {
      hideInMenu: true,
    },
    component: () => import("../views/results/NoAutoView.vue"),
  },
  {
    path: "/404",
    name: "未找到",
    meta: {
      hideInMenu: true,
    },
    component: () => import("../views/results/NotFoundView.vue"),
  },
  {
    path: "/about",
    name: "关于",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  },
];
